﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 运算符
{
    class Program
    {
        static void Main1(string[] args)
        {
            // int a1 = 5;
            // int a2 = 6;
            // int a3 = --a1 - a2;
            // Console.WriteLine(a3);
            //
            // byte b1 = 1;
            // byte b2 = 2;
            // Console.WriteLine(b1 & b2);
            // Console.WriteLine(b1 | b2);

            //int a = 4 > 6 ? 2 : 3;
            //Console.WriteLine(a);
            //
            //int x = 10;
            //int y = 20;
            //string h = x > y ? "你好" : "世界";
            //Console.WriteLine(h);

            //三元运算符高级用法
            while (true)
            {
                int score = int.Parse(Console.ReadLine());
                string lv = score >= 90 ? "优秀" :
                    score >= 70 ? "良好" :
                    score >= 60 ? "及格" :
                    "不及格";
                Console.WriteLine(lv);
            }
        }

        static void Main(string[] args)
        {
            while (true)
            {
                Random ran = new Random();//创建随机数对象
                int num = ran.Next(1, 101);// 生成一个随机数

                Console.WriteLine(num);

                //白色:50 绿色:30 紫色:15 橙色:5
                string lv = num >= 95 ? "橙色" :
                    num >= 80 ? "紫色" :
                    num >= 50 ? "绿色" :
                    "白色";
                Console.WriteLine(lv);
                Console.ReadLine();
            }
        }
    }
}
